unit ufmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dxBar, IniFiles, dxSkinsDefaultPainters, dxSkinsdxRibbonPainter,
  cxClasses, cxLookAndFeels, dxSkinsForm, dxRibbonForm,
  cxControls, dxStatusBar, dxRibbonStatusBar, dxRibbon, cxGraphics,
  cxLookAndFeelPainters;

type
  TfmMain = class(TDxRibbonForm)
    dxBarManager1: TdxBarManager;
    dxSkinController1: TdxSkinController;
    dxBarApplicationMenu1: TdxBarApplicationMenu;
    dxRibbonPopupMenu1: TdxRibbonPopupMenu;
    rtSEO: TdxRibbonTab;
    rbMenu: TdxRibbon;
    dxRibbonStatusBar1: TdxRibbonStatusBar;
    dxBarScreenTipRepository1: TdxBarScreenTipRepository;
    dxBarManager1Bar1: TdxBar;
    brSEOBase: TdxBar;
    brSystem: TdxBar;
    btnClose: TdxBarButton;
    rtSystem: TdxRibbonTab;
    rtAd: TdxRibbonTab;
    rtHelp: TdxRibbonTab;
    brSEOAnalysis: TdxBar;
    brAdLog: TdxBar;
    brAdAnalysis: TdxBar;
    btnPT: TdxBarButton;
    btnSEOType: TdxBarButton;
    procedure btnCloseClick(Sender: TObject);
    procedure btnPTClick(Sender: TObject);
    procedure btnSEOTypeClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
  public
    { Public declarations }
    procedure login;
  end;

var
  fmMain: TfmMain;

implementation

uses ufmLogin, HSEOM001, HSEOM002;

{$R *.dfm}

procedure TfmMain.btnCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TfmMain.btnPTClick(Sender: TObject);
begin
  if not Assigned(fmSEOM001) then
    fmSEOM001 := TfmSEOM001.Create(nil);
  fmSEOM001.Show;
end;

procedure TfmMain.btnSEOTypeClick(Sender: TObject);
begin
  if not Assigned(fmSEOM002) then
    fmSEOM002 := TfmSEOM002.Create(nil);
  fmSEOM002.Show;
end;

{ TfmMain }

procedure TfmMain.FormCreate(Sender: TObject);
var
  sSkinName: string;
  SetIniFile: TIniFile;
begin
  SetIniFile := TIniFile.Create(ExtractFileDir(Application.ExeName) + '\set.ini');
  try
    sSkinName := SetIniFile.ReadString('APPINF', 'SkinName', '');
  finally
    SetIniFile.Free;
  end;
  rbMenu.ColorSchemeName := 'UserSkin';
  dxSkinController1.SkinName:='UserSkin';
  dxSkinsUserSkinLoadFromFile(ExtractFilePath(ParamStr(0))+'xhHisSkin.skinres', sSkinName);
  dxSkinController1.NativeStyle:=False;
  dxSkinController1.UseSkins:=True;
end;

procedure TfmMain.login;
begin
  if not TfmLogin.Execute then
  begin
    Application.Terminate;
  end
  else
  begin
    if Application.Terminated then Exit;
    if not Self.Visible then Self.Show;
  end;
end;

end.
